﻿@{
    Layout = null;
}

@*<div>活动管理</div>*@
<link href="~/Content/MarketCss/animate.min.css" rel="stylesheet" />
<script src="~/Content/CommonCss/jqueryUI/jquery.cookie.js"></script>

<style>
    /*-------------------------------------------------------------------*/
    #phone .modal-body .phone-show > img {
        width: 100%;
        height: 100%;
    }

    #phone .modal-body .phone-show > #show-con {
        display:flex;
        justify-content:center;
        align-items:center;
        flex-direction:column;
    }

    #phone .modal-dialog{
        width: 300px;
    } 
    
    #phone .modal-content {
        border-radius: 10px;
        width: 300px;
        position:relative;
    }

    #phone .modal-content>button{
        position: absolute;
        top: 5px;
        right: 10px;
    }
        
    #phone .modal-body {
        height: 300px;
        display: flex;
        justify-content: center;
        align-items: center;
    } 
    
    .TSB_BodyTop {
        background: #f8f8f8;
        padding: 15px 38px;
        box-shadow: 0 0 1px rgba(0,0,0,.15);
    }

    .TSB_Label {
        cursor: pointer;
        width: 16px;
        height: 16px;
        border: 1px solid #999999;
        border-radius: 4px;
        position: relative;
        top: 4px;
    }

    .TSB_Label > input {
        opacity: 0;
    }

    .TSB_Body > li {
        box-shadow: 0 0 1px rgba(0,0,0,.15);
        padding: 15px 10px;
        display: -webkit-box;
        clear: both;
        height: 100%;
        width: 100%;
    }

    .div_icon {
        width: 40px;
        height: 40px;
        line-height: 40px;
        border-radius: 20px;
        background: #6cc788;
        display: inline-block;
        text-align: center;
        color: #FFFFFF;
    }

    .TSB_Body_Img {
        display: block;
        width: 90px;
        height: 70px;
        border-radius:4px;
    }

    .TSB_Body > li:hover {
        background-color: #f8f8f8;
    }

    .TSB_Body .btn-default {
        border: 1px solid #999999;
        margin: 0 5px;
    }

    .TSB_Body .btn {
        margin: 0 5px;
    }

    .TSB_BodyTop .btn {
        margin-left: 10px;
    }

    .Icon_Common {
        background: url(../../../Content/webImgs/TraceSource/OriginsMaterialList/Icon_Common.png) no-repeat;
    }

    .Icon_Gold {
        background: url(../../../Content/webImgs/TraceSource/OriginsMaterialList/Icon_Gold.png) no-repeat;
    }

    .Icon_Platinum {
        background: url(../../../Content/webImgs/TraceSource/OriginsMaterialList/Icon_Platinum.png) no-repeat;
    }

    .Icon_Diamond {
        background: url(../../../Content/webImgs/TraceSource/OriginsMaterialList/Icon_Diamond.png) no-repeat;
    }
</style>
<script src="~/Scripts/MGJJS/Market/ActivitiesManage.js"></script>

<script>
    function showPanel(obj) {
        
        $(obj).parent().parent().nextAll('.panel-collapse').toggle();
    }
</script>

<div class="mtlr15">
    <div class="row">
        <div class="col-lg-4 col-md-4 col-sm-4 col-lg-offset-8 col-md-offset-8 col-sm-offset-8">
            <div class="input-group">
                <input type="text" class="form-control" placeholder="活动名称" id="Asearch" onkeydown="if (event.keyCode == 13) { $.MGJ.ActivitiesManage.Ajax_GetActivtiesList(1); }">
                <span class="input-group-addon">
                    <span class="glyphicon glyphicon-search" onclick="$.MGJ.ActivitiesManage.Ajax_GetActivtiesList(1);"></span>
                </span>
            </div>
        </div>
    </div>
    <div>
        @*<div class="TSB_BodyTop">
            <input type="checkbox" id="AllClickCheckbox" class="AllClickCheckbox" />
            <label for="AllClickCheckbox">全选</label>
            <button class="btn btn-default" onclick="BatchDels()">删除</button>
        </div>*@
        <ul class="TSB_Body" style="display:none" id="ActivtiesList" binding="{'pageId':'ShoppingPager','pageCallback':'$.MGJ.ActivitiesManage.Ajax_GetActivtiesList','emptyHtml':ActivtiesList_EmptyHtml}">
            <li class="container-fluid container">
                 <div class="col-xs-8 col-sm-8 col-md-8 col-lg-8">
                    <div style="float:left;margin-left:13px">
                        <input style="margin-top:13px;" type="checkbox" class="text-left AllClickChild" name="Check" id="Check" binding="{'value':'Id'}" />
                    </div>
           
                    <div style="float: left; margin: 0 10px">
                        <div class="ChangeNameDiv" style="font-weight:bold;color:black" binding="{'text':'Title'}">
                        </div>
                        <div>
                            <input onblur="" class="ChangeNameInp" style="display:none" type="text" placeholder="请输入溯源码名称" />
                        </div>
                        <div>
                            <span>今天</span>
                            <span style="color: #50AE55" binding="{text:'StartDate','textHandle':$.MGJ.ActivitiesManage.DateFormat}"></span>
                            <span>扫码次数</span>
                            <span style="color: #50AE55" binding="{text:'scanCount'}"></span>
                            <span>次</span>
                            <span>累计扫码</span>
                            <span style="color: #50AE55" binding="{text:'sumScanCount'}"></span>
                            <span>次</span>
                            &nbsp; &nbsp;
                            <span>状态：</span>
                            <span style="color:green;" class="flagSpan" binding="{text:'ViewFlag','textHandle':$.MGJ.ActivitiesManage.Bin_ViewFlagSpan}"></span>
                        </div>
                        <div>
                            <span>批次：</span>
                            <span style="color: #50AE55" binding="{text:'Batch'}"></span>
                            <span>开始时间：</span>
                            <span style="color: #50AE55" binding="{text:'StartDate','textHandle':$.MGJ.ActivitiesManage.DateFormat}"></span>
                            <span>结束日期：</span>
                            <span style="color: #50AE55" binding="{text:'EndDate','textHandle':$.MGJ.ActivitiesManage.DateFormat}"></span>
                        </div>
                        <img class="TSB_Body_Img img-thumbnail" binding="{src:'ActivityType','srcHandle':$.MGJ.ActivitiesManage.Bin_src}" />
                   </div>
                </div>
                <div class="col-xs-4 col-sm-4 col-md-4 col-lg-4" style="display:flex;display:-webkit-flex;align-items: center;">
                    <button class="btn btn-success  viewFlagBtn"  binding="{'Id':'Id','text':'ViewFlag','ViewFlag':'ViewFlag','textHandle':$.MGJ.ActivitiesManage.Bin_ViewFlagBtn}" onclick="$.MGJ.ActivitiesManage.Ajax_IsState(this)" >启用</button>
                    <button class="btn btn-success" id="preview" binding="{'ActivityType':'ActivityType','Id':'Id','Batch':'Batch'}" data-toggle="modal" onclick="$.MGJ.ActivitiesManage.Ajax_ShowCode(this)">预览</button>
                    <button class="btn btn-success" id="edit" binding="{'ActivityType':'ActivityType','Id':'Id','ViewFlag':'ViewFlag'}" onclick="$.MGJ.ActivitiesManage.ActivtiesEdit(this)">编辑</button>
                    <button class="btn btn-success" binding="{'Id':'Id','ViewFlag':'ViewFlag'}" onclick="$.MGJ.ActivitiesManage.Ajax_activityDel(this)">删除</button>
                </div>
            </li>
        </ul>
    </div>
    <div id="ShoppingPager"></div>
    
</div>

<div id="phone" class="modal fade bs-example-modal-sm" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            @*<div class="modal-header" style="padding: 0px; background-color: transparent"></div>*@
            <div class="modal-body" style="padding:0">
                <div class="phone-show">
                    @*<img src="~/Content/webImgs/Market/CreateActivities/u598.png" />*@
                    <div id="show-con">
                        <div id="qr_code"></div>
                        <div id="hintText"></div>
                    </div>
                </div>
            </div>
            @*<button type="button" class="close" data-dismiss="alert" aria-label="Close">
                <span>×</span>
            </button>*@
        </div>
    </div>
</div>

<script src="~/Scripts/MGJJS/TraceSource/PageOperation/jquery.qrcode.min.js"></script>
<script>
    //点击预览     onclick不能调用$(function)里自定义的函数，因为作用域不一样
    //function showModal(ele) {
      
    //    //生成二维码
    //    //   var qrstring = "http://tapp.m12315.com/PreView/ActivityHome?aId="+$(ele).attr('Id');
    //    var qrstring = "http://tapp.m12315.com/WX/PreHome?aId=" + $(ele).attr('Id');
    //    $("#qr_code").html("");
    //    //二维码
    //    $("#qr_code").qrcode({
    //        width: 120, //宽度
    //        height: 120, //高度
    //        //text: qrsting //任意内容
    //        text: qrstring
    //    });
    //    $('#hintText').html('请用微信扫描预览');
    //}
  
    //function ActivtiesEdit(ele) {
    //    var ActivityType = $(ele).prev().attr('ActivityType');
    //    if (ActivityType === '2') {
    //        if ($(ele).prev().prev().attr("ViewFlag") == 1) {
    //            $.L.msgWarning("活动已启动，不能编辑！");
    //            return;
    //        }
    //        else {
    //            $('.main .big-right').load('/Market/RPActivity?Aid=' + $(ele).attr("Id") + "&batchID=" + $(ele).attr("Batch"));//红包
    //        }
    //    }
    //    else if (ActivityType === '1') {
    //        $('.main .big-right').load('/Market/TurntableActivity');//大转盘
            
    //    }
    //}
   
    window.ActivtiesList_EmptyHtml = '<li class="no-result text-center" style="display:block"> 无符合条件的数据结果 </li>';
    $.MGJ.ActivitiesManage.Ajax_GetActivtiesList(1, "");
</script>